<!--
 * @Author: your name
 * @Date: 2021-10-09 15:35:30
 * @LastEditTime: 2021-10-11 09:38:14
 * @LastEditors: Please set LastEditors
 * @Description: tabs
 * @FilePath: \web-demo\src\components\tabs.vue
-->
<template>
  <div
    v-for="(item, idx) in list"
    :key="idx"
    :class="{ active: tabIndex === idx }"
    @click="clickTab(item)"
  >
    {{ item.label }}
  </div>
</template>
<script>
export default {
  props: {
    list: {
      type: Array,
      default: () => [],
    },
    tabIndex: {
      type: String,
      default: () => '',
    },
  },
  emits: ['clickTab'],
  setup(props, context) {
    const clickTab = (item) => {
      context.emit("clickTab", item);
    };

    return {
      clickTab,
    };
  },
};
</script>
